﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
	xmlns:SilverAmp_Converters="clr-namespace:SilverAmp.Converters" xmlns:local="clr-namespace:SilverAmp.Extensions.MenuExtension" mc:Ignorable="d"
	x:Class="SilverAmp.MenuExtensionView"
	d:DesignWidth="565" d:DesignHeight="198">

	<UserControl.Resources>
        <SilverAmp_Converters:ExtensionTypeConverter x:Key="ExtensionTypeConverter"/>
        <SilverAmp_Converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
		<ItemsPanelTemplate x:Key="ItemsPanelTemplate1">    					
			<toolkit:WrapPanel Width="565">
				<toolkit:WrapPanel.Resources>
					<Style x:Key="WrapPanelStyle1" TargetType="toolkit:WrapPanel">
						<Setter Property="Orientation" Value="Horizontal"/>
					</Style>
				</toolkit:WrapPanel.Resources>
			</toolkit:WrapPanel>    					
		</ItemsPanelTemplate>
		<DataTemplate x:Key="DataTemplate1">
			<Grid Height="75" Width="75" Margin="10,5" 
                Visibility="{Binding IsVisibleInMenu, Converter={StaticResource BoolToVisibilityConverter}}" 
				d:DataContext="{d:DesignData /SampleData/SilverAmpExtensionSampleData.xaml}">
				<Border Background="{StaticResource DefaultBlueBrush}" CornerRadius="15" Opacity="0.25" />
				<Grid >
					<Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="{Binding DisplayIcon, Mode=OneWay}" Margin="10"/>
					<TextBlock Margin="0,0,0,10" Text="{Binding Name}" VerticalAlignment="Bottom" TextTrimming="WordEllipsis" Foreground="{StaticResource AlmostWhiteBrush}" Effect="{StaticResource ButtonGlow}" d:DataContext="{d:DesignData /SampleData/SilverAmpExtensionSampleData.xaml}" TextAlignment="Center"/>
				</Grid>
				<Grid Opacity="0.25" >
					<Rectangle RadiusX="15" RadiusY="15" Margin="5" StrokeThickness="5">
						<Rectangle.Stroke>
							<LinearGradientBrush EndPoint="0.983,0.983" StartPoint="0.004,0.002">
								<GradientStop Color="Black" Offset="0.947"/>
								<GradientStop Color="White" Offset="0.04"/>
								<GradientStop Color="#00D2D2D2" Offset="0.198"/>
								<GradientStop Color="#00272727" Offset="0.806"/>
							</LinearGradientBrush>
						</Rectangle.Stroke>
					</Rectangle>
				</Grid>
			</Grid>
		</DataTemplate>
	</UserControl.Resources>
   
    <Grid x:Name="LayoutRoot" d:DataContext="{d:DesignData /SampleData/PluginsViewModelSampleData.xaml}">

        <ListBox x:Name="listBox"  ItemsSource="{Binding Model.Extensions, Mode=TwoWay, Converter={StaticResource ExtensionTypeConverter},ConverterParameter=Regular}" 
			BorderBrush="{x:Null}" Background="{x:Null}" 
			HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
			ScrollViewer.HorizontalScrollBarVisibility="Disabled"
			ItemTemplate="{StaticResource DataTemplate1}"
			Style="{StaticResource ListBoxDefault}" ItemsPanel="{StaticResource ItemsPanelTemplate1}"
                      d:LayoutOverrides="Width, Height"
                      >
			<i:Interaction.Triggers>
				<i:EventTrigger EventName="SelectionChanged">
					<i:InvokeCommandAction Command="{Binding ChangeSelectedExtension}" CommandParameter="{Binding SelectedItem, ElementName=listBox}"/>
				</i:EventTrigger>
			</i:Interaction.Triggers>
    		
			<!--<ListBox.Style>
    				<StaticResource ResourceKey="ListBoxStyle1"/>
    			</ListBox.Style>
    			<ListBox.ItemTemplate>
    				<StaticResource ResourceKey="DataTemplate1"/>
    			</ListBox.ItemTemplate>
    			<ListBox.ItemsPanel>
    				<StaticResource ResourceKey="ItemsPanelTemplate1"/>
    			</ListBox.ItemsPanel>-->    			
			<i:Interaction.Behaviors>
				<ei:FluidMoveBehavior>
					<ei:FluidMoveBehavior.EaseY>
						<CubicEase EasingMode="EaseInOut"/>
					</ei:FluidMoveBehavior.EaseY>
					<ei:FluidMoveBehavior.EaseX>
						<CubicEase EasingMode="EaseInOut"/>
					</ei:FluidMoveBehavior.EaseX>
				</ei:FluidMoveBehavior>
			</i:Interaction.Behaviors>
		</ListBox>
	</Grid>
</UserControl>